<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title><%=title%></title>
		<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
	</head>
	<body>
		<div id="app">
			<img src="img/koa.png" height="64" width="64" alt="koa">
			<p>{{ message }}</p>
			用户名：<input v-model="e_username" type="text" /><br />
			密码：<input v-model="e_password" type="password" /><br />
			<button @click="login">登录</button>
			<p class="red">{{logininfo}}</p>
			
		</div>
		<script type="text/javascript">
			new Vue({
				el: '#app',
				data: {
					message: "Hello Vue.js!",
					logininfo: '',
					e_username:'',
					e_password:''
				},
				methods: {
					login: function() {
						axios.post('/validatelogin',{
							username:this.e_username,
							password:this.e_password
						}).then(response => (
						    this.logininfo = response.data.msg
						)).catch(function(error) {
							console.log(error);
						});
					}
				}
			});
		</script>
		<style type="text/css">
			.red{
				color: red;
			}
		</style>
	</body>
</html>
